/ Assembly List / LJCCreateFileChangesLib / CreateFileChanges / Run

Namespace - LJCCreateFileChangesLib


Syntax

C#
public Void Run()

Runs the create "Changes"file process.

Remarks

The Run() method uses the four required parameters that are initialized in the constructor.

sourceRoot - The full path to the source files root folder. The files in this folder and all subfolders are available for backup.

targetRoot - The full path to the target files root folder. The files in this folder and all subfolders are the target of the backup.
Note: Only those folders that exist in the target will be updated.This is how the user controls what folders to backup. The target folders must be manually created to be included in the backup. The source folders and target folders must have matching names.
This implicit approach prevents the user from having to specifically list the folders that are available for backup. The MissingFolders.txt file is written to show those folders that are not included.

changesFileSpec - The full file specification for the "Changes" file.

includeFilter - This is a list of file names that will are available for backup. The file names are separated with a vertial bar and can include wild cards and partial paths. Example: "*.cs|Doc\*.xml" This includes all files that end with the extension "cs" and all files that are in a "Doc" folder and end with the extension "xml".

skipFiles - This optional parameter is a list of files that will not be changed.The file names are separated with a vertical bar and can include wild cards.
Example: "Changes*.txt|?Build*.cmd" Files matching these names will not be updated or deleted.

If the "Source" file is different from the "Target" file, then a "Copy" record is written to the "Changes" file.
If a "Source" file is missing from the "Target", then a "Copy" record is written to the "Changes" file.
If a file exists in the "Target" folder but does not exist in the "Source" folder, then a "Delete" record is written to the "Changes" file.

Example

C#
using LJCCreateFileChangesLib;
using LJCBackupChangesLib;

// Create parameter values.
var sourceRoot = "C:\Visual Studio 2022\LJCProjectsDev";
var targetRoot = "C:\Visual Studio 2022\LJCProjects";
var changesFilespec = "C:\Visual Studio 2022\LJCProjectsDev\ChangesFile.txt";
var includeFilter = "*.cs|*.sln|*.csproj|*.Designer.cs|*.resx|*.config";
includeFilter += "|*.cmd|*.txt|*.sql|Doc\*.xml";
var skipFiles="?Build*.cmd|ClearBuild.cmd|UpdateAll.cmd|Build.txt";
skipFiles += "|ChangesFile.txt|BackupLog.txt|MissingFolders.txt";

// Create the "Changes" file.
var createFileChanges = new CreateFileChanges(sourceRoot, targetRoot
, changesFileSpec, includeFilter);
var skipList = skipFiles.Split('|').ToList<string>();
createFileChanges.SkipFiles = skipList;
createFileChanges.Run();

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.